<template>
	<div class="bargain" v-if="bargainData.result">
		<navBar></navBar>
		<bargainList v-for="item in bargainData1" :key="item.id" :item="item"></bargainList>
	</div>
</template>

<script>
import bargainList from '@/components/index/bargainList.vue';
import navBar from '@/components/index/navBar.vue';
import {requestBargain} from "@/plugins/api/home";

export default {
	name: 'bargain',
	components: {bargainList, navBar},
	data() {
		return {
			bargainData: [],
			bargainData1: []
		};
	},
	watch: {},
	computed: {},
	created() {

	},
	mounted() {
		this.getBargainData();
	},
	methods: {
		getBargainData() {
			requestBargain().then(res => {
				this.bargainData = res.data;
				for (let i = 0; i < 4; i++) {
					this.bargainData1.push(this.bargainData.goodsMap[this.bargainData.result[i].goodsId]);
				}
			});
		},
	}
};
</script>

<style lang="scss" scoped>

</style>